/**
 * Created by enixjin on 12/14/16.
 */
import {CommonModule} from "@angular/common";
import {HttpClientModule} from "@angular/common/http";
import {NgModule} from "@angular/core";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {RouterModule} from "@angular/router";

import {ChartsModule} from "ng2-charts/ng2-charts";
import {ModalModule} from "ngx-bootstrap";
import {BsDropdownModule} from "ngx-bootstrap/dropdown";
import {TabsModule} from "ngx-bootstrap/tabs";

import {
    APP_SIDEBAR_NAV,
    AppAsideComponent,
    AppBreadcrumbsComponent,
    AppFooterComponent,
    AppHeaderComponent,
    AppSidebarComponent,
    AppSidebarFooterComponent,
    AppSidebarFormComponent,
    AppSidebarHeaderComponent,
    AppSidebarMinimizerComponent
} from "../components";
// Import directives
import {
    AsideToggleDirective,
    NAV_DROPDOWN_DIRECTIVES,
    ReplaceDirective,
    SIDEBAR_TOGGLE_DIRECTIVES
} from '../directives';
import {WeUIModule} from "angular4-weui";
import {RiskCheckListComponent} from "./component/risk-check-list/risk-check-list";
import {RiskCheckItemListComponent} from "./component/risk-check-item-list/risk-check-item-list";
import {AdminExecutionListComponent} from "./component/admin-execution-list/admin-execution-list";
import {ExpertTaskListComponent} from "./component/expert-task-list/expert-task-list";
import {PipesModule} from "./pipes/pipe.module";
import {HttpModule} from "@angular/http";
import {RiskReportListComponent} from "./component/risk-report-list/risk-report-list.component";
import {RiskReportDetailComponent} from "./component/risk-report-detail/risk-report-detail.component";
import {QrCodeTaskListComponent} from "./component/qrcode-task-list/qrcode-task-list";
import {MyDatePickerModule} from "mydatepicker";
import {LoginComponent} from "./component/login/login.component";
import {RichTextComponent} from "./component/rich-text/rich-text.component";
import {SearchBarComponent} from "./component/search-bar/search-bar.component";
import {RiskExecutionListComponent} from "./component/risk-execution-list/risk-execution-list";

const APP_COMPONENTS = [
    AppAsideComponent,
    AppBreadcrumbsComponent,
    AppFooterComponent,
    AppHeaderComponent,
    AppSidebarComponent,
    AppSidebarFooterComponent,
    AppSidebarFormComponent,
    AppSidebarHeaderComponent,
    AppSidebarMinimizerComponent,
    APP_SIDEBAR_NAV
];


const APP_DIRECTIVES = [
    AsideToggleDirective,
    NAV_DROPDOWN_DIRECTIVES,
    ReplaceDirective,
    SIDEBAR_TOGGLE_DIRECTIVES
];

const RISK_COMPONENTS = [
  RiskCheckListComponent,
  RiskCheckItemListComponent,
  AdminExecutionListComponent,
  ExpertTaskListComponent,
  RiskReportListComponent,
  RiskReportDetailComponent,
  QrCodeTaskListComponent,
  RiskExecutionListComponent
];

const COMMON_COMPONENTS = [
  RichTextComponent,
  SearchBarComponent
]

@NgModule({
    imports: [
        CommonModule,
        RouterModule,
        HttpClientModule,
        HttpModule,
        FormsModule,
        ReactiveFormsModule,
        BsDropdownModule.forRoot(),
        TabsModule.forRoot(),
        ModalModule.forRoot(),
        ChartsModule,
        WeUIModule,
      PipesModule,
      MyDatePickerModule
    ],
    declarations: [
        ...RISK_COMPONENTS,
        ...COMMON_COMPONENTS,
        LoginComponent
    ],
    exports: [CommonModule,
        FormsModule,
        ReactiveFormsModule,
        RouterModule,
        HttpClientModule,
        HttpModule,
        BsDropdownModule,
        TabsModule,
        ModalModule,
        ChartsModule,
        PipesModule,
        ...RISK_COMPONENTS,
        ...COMMON_COMPONENTS,
        LoginComponent,
        WeUIModule,
        MyDatePickerModule
    ]
})
export class SharedModules {
}
